import { createApp } from "vue";
import root from "./App.vue";
import { createPinia } from "pinia";
import setupRouter from "./router";
import setupDirectives from "./directive";
import setupAdminLog from "@/config/log";
import type { App } from "vue";

function setupApp() {
  const app: App = createApp(root);

  app.use(createPinia());

// //mqtt 参数配置
// const options = {
//   clean: true,
//   clientId: "emqx_vue3-" + AdminStore.orgId ,
//   //"emqx_vue3_" + Math.random().toString(16).substring(2, 8),
//   connectTimeout: 10 * 1000, // ms,
//   host: "taoyida.top",
//   username: "tlk555666",
//   password: "tlk555666",
//   port: 15676,
//   protocol: "wss",
//   reconnectPeriod: 4000, // ms
//   subscription: { topic: "organization-snack-order:4" , qos: 1 } //需要动态配置
// };
// // 使用hoosk函数导出的值
// const { data, connection, subscription } = useMqtt(options);

// console.log("connection------", connection);
// console.log("subscription----------", subscription);
// console.log("data------", data);

  setupRouter(app);

  setupDirectives(app);

  setupAdminLog();

  app.mount("#app");
}

setupApp();
